const { Sequelize } = require("sequelize");

const {
  MYSQL_HOST,
  MYSQL_USERNAME,
  MYSQL_PASSWORD,
  MYSQL_DATABASE,
} = require("../config/config.default");

const sequelize = new Sequelize(
  MYSQL_DATABASE,
  MYSQL_USERNAME,
  MYSQL_PASSWORD,
  {
    host: MYSQL_HOST,
    dialect: "mysql",
  }
);

// sequelize
//   .authenticate()
//   .then(() => {
//     console.log("数据库连接成功");
//   })
//   .catch((error) => {
//     console.error("数据库连接失败", error);
//   });
module.exports = sequelize;
